package com.dayuanit.dy15.websocket.dto;

public class ResponseDTO {
    //1000-成功 9999-失败
    public static final int SUCCESS_CODE = 1000;
    public static final int FAIL_CODE = 9999;
    public static final int un_login_CODE = 5000;


    private int code;
    private String message = "";
    private Object data;

    private ResponseDTO() {}
    private ResponseDTO(int code) {
        this.code = code;
    }

    private ResponseDTO(int code, String message) {
        this.code = code;
        this.message = message;
    }

    private ResponseDTO(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static ResponseDTO sucess() {
        return new ResponseDTO(SUCCESS_CODE);
    }

    public static ResponseDTO sucess(Object data) {
        return new ResponseDTO(SUCCESS_CODE, "", data);
    }

    public static ResponseDTO fail(String message) {
        return new ResponseDTO(FAIL_CODE, message);
    }

    public static ResponseDTO unLogin(String message) {
        return new ResponseDTO(un_login_CODE, message);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
